package gggameserver.games.khet;

import gggameserver.games.Position;

import java.util.ArrayList;

public class KhetShotResult {

	public ArrayList<Position> trajectory;
	public KhetPiece destroyedPiece;

	public KhetShotResult(ArrayList<Position> trajectory, KhetPiece piece) {
		this.trajectory = trajectory;

		if (null != piece) {
			this.destroyedPiece = piece.clonePiece();
		} else {
			this.destroyedPiece = null;
		}
	}

	public final ArrayList<Position> getTrajectory() {
		return this.trajectory;
	}

	public Position getDestroyedPosition() {
		if (!isPieceDestroyed())
			return null;

		int len = trajectory.size();
		return new Position(trajectory.get(len - 1));
	}

	public KhetPiece getDestroyedPiece() {
		return this.destroyedPiece;
	}

	public boolean isPieceDestroyed() {
		return this.destroyedPiece != null;
	}

}
